#pragma once
#include "DXAMLCommon.h"
#include "XamlSchemaContext.h"
#include "XamlPropertyToken.h"
#include "XamlTypeToken.h"
#include "XamlTextSyntax.h"
#include "XamlType.h"
//#include "XamlQualifiedObject.h"
#include "XamlNamespace.h"
#include "XamlBitSet.h"
class XamlType;

struct XamlQualifiedObject;


class XamlProperty :
	public IXamlSchemaObject
{
protected: 
	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<XamlNamespace> & inNamespace, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType, const xshared_ptr<XamlTextSyntax> & inXamlTextSyntax);
	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlTextSyntax> & inXamlTextSyntax);
	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<XamlNamespace> & sPropertyTypeToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType);
	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const struct XamlTypeToken & sPropertyTypeToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType);
	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType);
	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken);
	XamlProperty();
public: 
	virtual ~XamlProperty();
	static HRESULT Create(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const struct XamlTypeToken & inPropertyTypeToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType, xshared_ptr<XamlProperty> & outProperty);
	static XUINT32 AreEqual(const xshared_ptr<XamlProperty> & spFirst, const xshared_ptr<XamlProperty> & spSecond);
	XBOOL IsUnknown();
	XBOOL IsPublic();
	XBOOL IsBrowsable();
	XBOOL IsReadOnly();
	XBOOL IsStatic();
	XBOOL IsAttachable();
	XBOOL IsEvent();
	XBOOL IsAmbient();
	virtual XBOOL IsImplicit();
	virtual XBOOL IsDirective();
	HRESULT get_Name(xshared_ptr<CXString> & outName);
	HRESULT get_FullName(xshared_ptr<CXString> & outFullName);
	virtual HRESULT get_DeclaringType(xshared_ptr<XamlType> & outDeclaringType);
	HRESULT get_Type(xshared_ptr<XamlType> & outType);
	HRESULT get_TargetType(xshared_ptr<XamlType> &);
	HRESULT get_TextSyntax(xshared_ptr<XamlTextSyntax> & outTextSyntax);
	virtual HRESULT get_XamlNamespace(xshared_ptr<XamlNamespace> & outNamespace);
	const struct XamlPropertyToken & get_PropertyToken();
	HRESULT SetRuntimeIndex(XUINT32 uiRuntimeIndex);
	XUINT32 get_RuntimeIndex() const;
	virtual enum ImplicitPropertyType get_ImplicitPropertyType();
	virtual enum XamlDirectives get_DirectiveKind();
	virtual enum AllowedPropertyLocation AllowedLocation();
	HRESULT DependsOn(xshared_ptr<XamlProperty> &);
	HRESULT GetValue(const xshared_ptr<XamlQualifiedObject> & qoInstance, xshared_ptr<XamlQualifiedObject> & rqoOut);
	HRESULT SetValue(const xshared_ptr<XamlType> & spType, const xshared_ptr<XamlQualifiedObject> & qoInstance, const xshared_ptr<XamlQualifiedObject> & qoValue, XBOOL bAllowEvents, XBOOL bBindTemplates);
protected: 
	void SetBoolPropertyBit(enum BoolPropertyBits, XBOOL);
	void SetBoolPropertyBits(const XamlBitSet<enum BoolPropertyBits> & fPropertyBits, const XamlBitSet<enum BoolPropertyBits> & fValueBits);
	HRESULT GetBoolPropertyBit(enum BoolPropertyBits, XBOOL &);
	HRESULT RetrieveBoolPropertyBits(const XamlBitSet<enum BoolPropertyBits> & fPropertyBits);
	HRESULT GetSchemaContext(xshared_ptr<XamlSchemaContext> & outSchemaContext);
private: 
	XamlBitSet<enum BoolPropertyBits> m_flagsBoolPropertyBits;
	XamlBitSet<enum BoolPropertyBits> m_flagsBoolPropertyValidBits;
	struct XamlPropertyToken m_sPropertyToken;
	struct XamlTypeToken m_sPropertyTypeToken;
	xweak_ptr<XamlSchemaContext> m_spSchemaContext;
	xshared_ptr<CXString> m_spName;
	xweak_ptr<XamlNamespace> m_spXamlNamespace;
	xweak_ptr<XamlType> m_spDeclaringType;
	xweak_ptr<XamlType> m_spType;
	xweak_ptr<XamlType> m_spTargetType;
	xshared_ptr<XamlTextSyntax> m_spXamlTextSyntax;
	xshared_ptr<XamlProperty> m_spDependsOnProperty;
	xshared_ptr<XamlTextSyntax> m_spTextSyntax;
	XUINT32 m_uiRuntimeIndex;
};

//
//class XamlProperty :
//	public IXamlSchemaObject
//{
//
//protected: 
//	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<XamlNamespace> & inNamespace, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType, const xshared_ptr<XamlTextSyntax> & inXamlTextSyntax);
//	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlTextSyntax> & inXamlTextSyntax);
//	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<XamlNamespace> & inNamespace, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inUnknownDeclaringType);
//	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const struct XamlTypeToken & sPropertyTypeToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType);
//	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType);
//	XamlProperty(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken);
//	XamlProperty();
//public: 
//	virtual ~XamlProperty();
//	static HRESULT Create(const xshared_ptr<XamlSchemaContext> & spSchemaContext, const struct XamlPropertyToken & sPropertyToken, const struct XamlTypeToken & inPropertyTypeToken, const xshared_ptr<CXString> & inPropertyName, const xshared_ptr<XamlType> & inPropertyType, xshared_ptr<XamlProperty> & outProperty);
//	static XBOOL AreEqual(const xshared_ptr<XamlProperty> & spFirst, const xshared_ptr<XamlProperty> & spSecond);
//	XBOOL IsUnknown();
//	XBOOL IsPublic();
//	XBOOL IsBrowsable();
//	XBOOL IsReadOnly();
//	XBOOL IsStatic();
//	XBOOL IsAttachable();
//	XBOOL IsEvent();
//	XBOOL IsAmbient();
//	virtual XBOOL IsImplicit();
//	virtual XBOOL IsDirective();
//	HRESULT get_Name(xshared_ptr<CXString> & outName);
//	HRESULT get_FullName(xshared_ptr<CXString> & outFullName);
//	virtual HRESULT get_DeclaringType(xshared_ptr<XamlType> & outDeclaringType);
//	HRESULT get_Type(xshared_ptr<XamlType> & outType);
//	HRESULT get_TargetType(xshared_ptr<XamlType> &);
//	HRESULT get_TextSyntax(xshared_ptr<XamlTextSyntax> & outTextSyntax);
//	virtual HRESULT get_XamlNamespace(xshared_ptr<XamlNamespace> & outNamespace);
//	const struct XamlPropertyToken & get_PropertyToken();
//	HRESULT SetRuntimeIndex(XUINT32 uiRuntimeIndex);
//	XUINT32 get_RuntimeIndex();
//	virtual enum ImplicitPropertyType get_ImplicitPropertyType();
//	virtual enum XamlDirectives get_DirectiveKind();
//	virtual enum AllowedPropertyLocation AllowedLocation();
//	HRESULT DependsOn(xshared_ptr<XamlProperty> &);
//	HRESULT GetValue(const xshared_ptr<XamlQualifiedObject> & qoInstance, xshared_ptr<XamlQualifiedObject> & rqoOut);
//	HRESULT SetValue(const xshared_ptr<XamlType> & spType, const xshared_ptr<XamlQualifiedObject> & qoInstance, const xshared_ptr<XamlQualifiedObject> & qoValue, XBOOL bAllowEvents, XBOOL bBindTemplates);
//protected: 
//	void SetBoolPropertyBit(enum BoolPropertyBits fPropertyBit, XUINT32 bValue);
//	void SetBoolPropertyBits(const XamlBitSet<enum BoolPropertyBits> & fPropertyBits, const XamlBitSet<enum BoolPropertyBits> & fValueBits);
//	HRESULT GetBoolPropertyBit(enum BoolPropertyBits fPropertyBit, XUINT32 & fValue);
//	HRESULT RetrieveBoolPropertyBits(const XamlBitSet<enum BoolPropertyBits> & fPropertyBits);
//	HRESULT GetSchemaContext(xshared_ptr<XamlSchemaContext> & outSchemaContext);
//private: 
//	XamlBitSet<enum BoolPropertyBits> m_flagsBoolPropertyBits;
//
//
//private: 
//	XamlBitSet<enum BoolPropertyBits> m_flagsBoolPropertyValidBits;
//	struct XamlPropertyToken m_sPropertyToken;
//	struct XamlTypeToken m_sPropertyTypeToken;
//	xweak_ptr<XamlSchemaContext> m_spSchemaContext;
//	xshared_ptr<CXString> m_spName;
//	xweak_ptr<XamlNamespace> m_spXamlNamespace;
//	xweak_ptr<XamlType> m_spDeclaringType;
//	xweak_ptr<XamlType> m_spType;
//	xweak_ptr<XamlType> m_spTargetType; 
//	xshared_ptr<XamlTextSyntax> m_spXamlTextSyntax; 
//	xshared_ptr<XamlProperty> m_spDependsOnProperty;
//	xshared_ptr<XamlTextSyntax> m_spTextSyntax; 
//	XUINT32 m_uiRuntimeIndex;
//};



